<?php

/**
 * This is the model class for table "blacklist_tamu".
 *
 * The followings are the available columns in table 'blacklist_tamu':
 * @property string $id_blacklist_tamu
 * @property string $alasan
 * @property string $id_tamu
 *
 * The followings are the available model relations:
 * @property MstTamu $idTamu
 */
class BlacklistTamu extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return BlacklistTamu the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'blacklist_tamu';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('alasan, id_tamu', 'required'),
			array('alasan', 'length', 'max'=>500),
			array('id_tamu', 'length', 'max'=>20),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id_blacklist_tamu, alasan, id_tamu', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'idTamu' => array(self::BELONGS_TO, 'MstTamu', 'id_tamu'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id_blacklist_tamu' => 'Id Blacklist Tamu',
			'alasan' => 'Alasan',
			'id_tamu' => 'Id Tamu',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id_blacklist_tamu',$this->id_blacklist_tamu,true);
		$criteria->compare('alasan',$this->alasan,true);
		$criteria->compare('id_tamu',$this->id_tamu,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}